home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000 #2
/
Ham Radio 2000 - Volume 2.iso
/
HAMV2
/
TCP_IP
/
TNOS230S
/
DEVPARAM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1996-12-23
|
2KB
|
81 lines
#include "global.h"
#include "ctype.h"
#include "devparam.h"
#if !defined(_lint)
static char rcsid[] OPTIONAL = "$Id: devparam.c,v 1.12 1996/12/23 20:37:36 root Exp root $";
#endif
struct param {
int number;
const char *name;
};
static struct param Parms[] = {
{ PARAM_DATA, "Data" },
{ PARAM_TXDELAY, "TxDelay" },
{ PARAM_PERSIST, "Persist" },
{ PARAM_SLOTTIME, "SlotTime" },
{ PARAM_TXTAIL, "TxTail" },
{ PARAM_FULLDUP, "FullDup" },
{ PARAM_HW, "Hardware" },
{ PARAM_MUTE, "TxMute" },
{ PARAM_DTR, "DTR" },
{ PARAM_RTS, "RTS" },
{ PARAM_SPEED, "Speed" },
{ PARAM_ENDDELAY, "EndDelay" },
{ PARAM_GROUP, "Group" },
{ PARAM_IDLE, "Idle" },
{ PARAM_MIN, "Min" },
{ PARAM_MAXKEY, "MaxKey" },
{ PARAM_WAIT, "Wait" },
{ PARAM_DOWN, "Down" },
{ PARAM_UP, "Up" },
{ PARAM_BLIND, "Blind" },
{ PARAM_RCV_MODE, "RcvMode"}, /* packet driver receive mode - WG7J */
{ PARAM_RETURN, "Return" },
{ PARAM_RETURN2, "Return2" },
{ -1, NULLCHAR }
};
/* Convert a packet radio interface control token into a number
* Used by the various ioctl routines and by KISS TNC commands
*/
int
devparam(s)
char *s;
{
int len;
struct param *sp;
if (s) {
len = (int) strlen(s);
if(isdigit(s[0]))
return atoi(s);
sp = &Parms[0];
while(sp->number != -1){
if(strnicmp(s,sp->name,(size_t)len) == 0)
return sp->number;
sp++;
}
}
return -1;
}
const char *
parmname(n)
int n;
{
struct param *sp;
sp = &Parms[0];
while(sp->number != -1){
if(sp->number == n)
return sp->name;
sp++;
}
return NULLCHAR;
}